.class public Lrexsee/multimedia/RexseeImage;
.super Ljava/lang/Object;
.source "RexseeImage.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# static fields
.field private static final INTERFACE_NAME:Ljava/lang/String; = "Image"


# instance fields
.field private final mBrowser:Lrexsee/core/browser/Browser;

.field protected final mContext:Landroid/content/Context;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 43
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 44
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    .line 45
    iput-object p1, p0, Lrexsee/multimedia/RexseeImage;->mContext:Landroid/content/Context;

    .line 46
    return-void
.end method

.method public constructor <init>(Lrexsee/core/browser/Browser;)V
    .locals 1
    .param p1, "browser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 37
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 39
    iput-object p1, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    .line 40
    invoke-virtual {p1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lrexsee/multimedia/RexseeImage;->mContext:Landroid/content/Context;

    .line 42
    return-void
.end method

.method public static getFormat(Ljava/lang/String;)Landroid/graphics/Bitmap$CompressFormat;
    .locals 1
    .param p0, "path"    # Ljava/lang/String;

    .prologue
    .line 49
    invoke-virtual {p0}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object p0

    .line 50
    const-string v0, ".jpg"

    invoke-virtual {p0, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_0

    const-string v0, "jpeg"

    invoke-virtual {p0, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1

    :cond_0
    sget-object v0, Landroid/graphics/Bitmap$CompressFormat;->JPEG:Landroid/graphics/Bitmap$CompressFormat;

    .line 52
    :goto_0
    return-object v0

    .line 51
    :cond_1
    const-string v0, ".png"

    invoke-virtual {p0, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_2

    sget-object v0, Landroid/graphics/Bitmap$CompressFormat;->PNG:Landroid/graphics/Bitmap$CompressFormat;

    goto :goto_0

    .line 52
    :cond_2
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public static saveBitmap(Lrexsee/core/browser/Browser;Landroid/graphics/Bitmap;ILjava/lang/String;)Z
    .locals 7
    .param p0, "browser"    # Lrexsee/core/browser/Browser;
    .param p1, "bitmap"    # Landroid/graphics/Bitmap;
    .param p2, "quality"    # I
    .param p3, "target"    # Ljava/lang/String;

    .prologue
    const/4 v5, 0x0

    const-string v6, "Save Bitmap"

    .line 55
    if-nez p1, :cond_0

    .line 56
    const-string v4, "Save Bitmap"

    const-string v4, "Null bitmap."

    invoke-virtual {p0, v6, v4}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    move v4, v5

    .line 72
    :goto_0
    return v4

    .line 59
    :cond_0
    invoke-static {p3}, Lrexsee/core/utilities/Utilities;->prepareWriteFile(Ljava/lang/String;)Ljava/io/File;

    move-result-object v3

    .line 60
    .local v3, "tFile":Ljava/io/File;
    if-nez v3, :cond_1

    .line 61
    const-string v4, "Save Bitmap"

    const-string v4, "Error on preparing target file."

    invoke-virtual {p0, v6, v4}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    move v4, v5

    .line 62
    goto :goto_0

    .line 65
    :cond_1
    :try_start_0
    new-instance v1, Ljava/io/FileOutputStream;

    invoke-direct {v1, v3}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V

    .line 66
    .local v1, "fileOutput":Ljava/io/FileOutputStream;
    invoke-static {p3}, Lrexsee/multimedia/RexseeImage;->getFormat(Ljava/lang/String;)Landroid/graphics/Bitmap$CompressFormat;

    move-result-object v4

    invoke-virtual {p1, v4, p2, v1}, Landroid/graphics/Bitmap;->compress(Landroid/graphics/Bitmap$CompressFormat;ILjava/io/OutputStream;)Z

    move-result v2

    .line 67
    .local v2, "rtn":Z
    invoke-virtual {v1}, Ljava/io/FileOutputStream;->flush()V

    .line 68
    invoke-virtual {v1}, Ljava/io/FileOutputStream;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move v4, v2

    .line 69
    goto :goto_0

    .line 70
    .end local v1    # "fileOutput":Ljava/io/FileOutputStream;
    .end local v2    # "rtn":Z
    :catch_0
    move-exception v4

    move-object v0, v4

    .line 71
    .local v0, "e":Ljava/lang/Exception;
    const-string v4, "Save Bitmap"

    invoke-virtual {p0, v6, v0}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    move v4, v5

    .line 72
    goto :goto_0
.end method


# virtual methods
.method public getExif(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .locals 9
    .param p1, "path"    # Ljava/lang/String;
    .param p2, "tag"    # Ljava/lang/String;

    .prologue
    const-string v7, "file://"

    const-string v8, ""

    .line 154
    invoke-virtual {p1}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v2

    .line 155
    .local v2, "p":Ljava/lang/String;
    const-string v5, "file://"

    invoke-virtual {v2, v7}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v5

    if-nez v5, :cond_0

    .line 156
    iget-object v5, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/multimedia/RexseeImage;->getInterfaceName()Ljava/lang/String;

    move-result-object v6

    const-string v7, "Only the images in the external storage can be set exif."

    invoke-virtual {v5, v6, v7}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    .line 157
    const-string v5, ""

    move-object v5, v8

    .line 171
    :goto_0
    return-object v5

    .line 159
    :cond_0
    const-string v5, "file:///android_asset"

    invoke-virtual {v2, v5}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v5

    if-eqz v5, :cond_3

    .line 160
    const-string v5, "mounted"

    invoke-static {}, Landroid/os/Environment;->getExternalStorageState()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v5

    if-nez v5, :cond_1

    const-string v5, ""

    move-object v5, v8

    goto :goto_0

    .line 161
    :cond_1
    new-instance v5, Ljava/lang/StringBuilder;

    const-string v6, "file://"

    invoke-direct {v5, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;

    move-result-object v6

    invoke-virtual {v6}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    const-string v6, "/tmpAssetImage.jpg"

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    .line 162
    .local v4, "sdPath":Ljava/lang/String;
    iget-object v5, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {v5}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v5

    const/16 v6, 0x16

    invoke-virtual {p1, v6}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6, v4}, Lrexsee/core/utilities/Utilities;->copyAssetToExternalStorage(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Z

    move-result v5

    if-nez v5, :cond_2

    const-string v5, ""

    move-object v5, v8

    goto :goto_0

    .line 163
    :cond_2
    move-object p1, v4

    .line 166
    .end local v4    # "sdPath":Ljava/lang/String;
    :cond_3
    :try_start_0
    new-instance v1, Landroid/media/ExifInterface;

    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v5

    invoke-virtual {v5}, Landroid/net/Uri;->getPath()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v1, v5}, Landroid/media/ExifInterface;-><init>(Ljava/lang/String;)V

    .line 167
    .local v1, "exif":Landroid/media/ExifInterface;
    invoke-virtual {v1, p2}, Landroid/media/ExifInterface;->getAttribute(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    .line 168
    .local v3, "rtn":Ljava/lang/String;
    if-nez v3, :cond_4

    const-string v5, ""
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-object v5, v8

    goto :goto_0

    :cond_4
    move-object v5, v3

    goto :goto_0

    .line 169
    .end local v1    # "exif":Landroid/media/ExifInterface;
    .end local v3    # "rtn":Ljava/lang/String;
    :catch_0
    move-exception v5

    move-object v0, v5

    .line 170
    .local v0, "e":Ljava/lang/Exception;
    iget-object v5, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/multimedia/RexseeImage;->getInterfaceName()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6, v0}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    .line 171
    const-string v5, ""

    move-object v5, v8

    goto :goto_0
.end method

.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 27
    return-object p0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 23
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "Image"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 1
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 31
    new-instance v0, Lrexsee/multimedia/RexseeImage;

    invoke-direct {v0, p1}, Lrexsee/multimedia/RexseeImage;-><init>(Lrexsee/core/browser/Browser;)V

    return-object v0
.end method

.method public getSize(Ljava/lang/String;)Ljava/lang/String;
    .locals 4
    .param p1, "path"    # Ljava/lang/String;

    .prologue
    .line 144
    iget-object v2, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    const/4 v3, 0x0

    invoke-static {v2, p1, v3}, Lrexsee/core/style/RexseeDrawable;->getDrawable(Lrexsee/core/browser/Browser;Ljava/lang/String;Landroid/graphics/drawable/Drawable;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    .line 145
    .local v0, "drawable":Landroid/graphics/drawable/Drawable;
    if-nez v0, :cond_0

    const-string v2, "{}"

    .line 150
    :goto_0
    return-object v2

    .line 146
    :cond_0
    const-string v1, "{"

    .line 147
    .local v1, "rtn":Ljava/lang/String;
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, "\"width\":"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 148
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, ",\"height\":"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 149
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, "}"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    move-object v2, v1

    .line 150
    goto :goto_0
.end method

.method public declared-synchronized scale(Ljava/lang/String;II)Z
    .locals 6
    .param p1, "source"    # Ljava/lang/String;
    .param p2, "width"    # I
    .param p3, "height"    # I

    .prologue
    .line 109
    monitor-enter p0

    const/16 v5, 0x50

    move-object v0, p0

    move-object v1, p1

    move-object v2, p1

    move v3, p2

    move v4, p3

    :try_start_0
    invoke-virtual/range {v0 .. v5}, Lrexsee/multimedia/RexseeImage;->scale(Ljava/lang/String;Ljava/lang/String;III)Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized scale(Ljava/lang/String;Ljava/lang/String;II)Z
    .locals 6
    .param p1, "source"    # Ljava/lang/String;
    .param p2, "target"    # Ljava/lang/String;
    .param p3, "width"    # I
    .param p4, "height"    # I

    .prologue
    .line 106
    monitor-enter p0

    const/16 v5, 0x50

    move-object v0, p0

    move-object v1, p1

    move-object v2, p2

    move v3, p3

    move v4, p4

    :try_start_0
    invoke-virtual/range {v0 .. v5}, Lrexsee/multimedia/RexseeImage;->scale(Ljava/lang/String;Ljava/lang/String;III)Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized scale(Ljava/lang/String;Ljava/lang/String;III)Z
    .locals 10
    .param p1, "source"    # Ljava/lang/String;
    .param p2, "target"    # Ljava/lang/String;
    .param p3, "width"    # I
    .param p4, "height"    # I
    .param p5, "quality"    # I

    .prologue
    const/4 v9, 0x0

    .line 79
    monitor-enter p0

    :try_start_0
    invoke-static {p1}, Lrexsee/core/utilities/Utilities;->prepareReadFile(Ljava/lang/String;)Ljava/io/File;

    move-result-object v4

    .line 80
    .local v4, "sFile":Ljava/io/File;
    if-nez v4, :cond_0

    .line 81
    iget-object v6, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/multimedia/RexseeImage;->getInterfaceName()Ljava/lang/String;

    move-result-object v7

    const-string v8, "Error on preparing source file."

    invoke-virtual {v6, v7, v8}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move v6, v9

    .line 102
    .end local v4    # "sFile":Ljava/io/File;
    :goto_0
    monitor-exit p0

    return v6

    .line 84
    .restart local v4    # "sFile":Ljava/io/File;
    :cond_0
    :try_start_1
    invoke-virtual {v4}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v6

    invoke-static {v6}, Landroid/graphics/BitmapFactory;->decodeFile(Ljava/lang/String;)Landroid/graphics/Bitmap;

    move-result-object v3

    .line 85
    .local v3, "sBitmap":Landroid/graphics/Bitmap;
    invoke-virtual {v3}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v5

    .line 86
    .local v5, "w":I
    invoke-virtual {v3}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v1

    .line 87
    .local v1, "h":I
    if-gtz p3, :cond_1

    if-gtz p4, :cond_1

    move v6, v9

    .line 88
    goto :goto_0

    .line 89
    :cond_1
    if-gtz p3, :cond_3

    .line 90
    mul-int v6, v5, p4

    div-int p3, v6, v1

    .line 94
    :cond_2
    :goto_1
    const/4 v6, 0x0

    invoke-static {v3, p3, p4, v6}, Landroid/graphics/Bitmap;->createScaledBitmap(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;

    move-result-object v3

    .line 95
    if-nez v3, :cond_4

    move v6, v9

    goto :goto_0

    .line 91
    :cond_3
    if-gtz p4, :cond_2

    .line 92
    mul-int v6, v1, p3

    div-int p4, v6, v5

    goto :goto_1

    .line 96
    :cond_4
    iget-object v6, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-static {v6, v3, p5, p2}, Lrexsee/multimedia/RexseeImage;->saveBitmap(Lrexsee/core/browser/Browser;Landroid/graphics/Bitmap;ILjava/lang/String;)Z

    move-result v2

    .line 97
    .local v2, "rtn":Z
    invoke-virtual {v3}, Landroid/graphics/Bitmap;->recycle()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 98
    const/4 v3, 0x0

    move v6, v2

    .line 99
    goto :goto_0

    .line 100
    .end local v1    # "h":I
    .end local v2    # "rtn":Z
    .end local v3    # "sBitmap":Landroid/graphics/Bitmap;
    .end local v4    # "sFile":Ljava/io/File;
    .end local v5    # "w":I
    :catch_0
    move-exception v6

    move-object v0, v6

    .line 101
    .local v0, "e":Ljava/lang/Exception;
    :try_start_2
    iget-object v6, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/multimedia/RexseeImage;->getInterfaceName()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v6, v7, v0}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    move v6, v9

    .line 102
    goto :goto_0

    .line 79
    .end local v0    # "e":Ljava/lang/Exception;
    :catchall_0
    move-exception v6

    monitor-exit p0

    throw v6
.end method

.method public declared-synchronized scaleByRate(Ljava/lang/String;F)Z
    .locals 1
    .param p1, "source"    # Ljava/lang/String;
    .param p2, "rate"    # F

    .prologue
    .line 126
    monitor-enter p0

    :try_start_0
    invoke-virtual {p0, p1, p1, p2}, Lrexsee/multimedia/RexseeImage;->scaleByRate(Ljava/lang/String;Ljava/lang/String;F)Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized scaleByRate(Ljava/lang/String;Ljava/lang/String;F)Z
    .locals 10
    .param p1, "source"    # Ljava/lang/String;
    .param p2, "target"    # Ljava/lang/String;
    .param p3, "rate"    # F

    .prologue
    const/4 v9, 0x0

    .line 113
    monitor-enter p0

    const/4 v0, 0x0

    cmpg-float v0, p3, v0

    if-gtz v0, :cond_0

    move v0, v9

    .line 122
    :goto_0
    monitor-exit p0

    return v0

    .line 114
    :cond_0
    :try_start_0
    invoke-static {p1}, Lrexsee/core/utilities/Utilities;->prepareReadFile(Ljava/lang/String;)Ljava/io/File;

    move-result-object v8

    .line 115
    .local v8, "sFile":Ljava/io/File;
    if-nez v8, :cond_1

    move v0, v9

    goto :goto_0

    .line 116
    :cond_1
    invoke-virtual {v8}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/graphics/BitmapFactory;->decodeFile(Ljava/lang/String;)Landroid/graphics/Bitmap;

    move-result-object v7

    .line 117
    .local v7, "sBitmap":Landroid/graphics/Bitmap;
    invoke-virtual {v7}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v0

    int-to-float v0, v0

    mul-float/2addr v0, p3

    invoke-static {v0}, Ljava/lang/Math;->round(F)I

    move-result v3

    .line 118
    .local v3, "width":I
    invoke-virtual {v7}, Landroid/graphics/Bitmap;->recycle()V

    .line 119
    const/4 v7, 0x0

    .line 120
    const/4 v4, 0x0

    const/16 v5, 0x50

    move-object v0, p0

    move-object v1, p1

    move-object v2, p2

    invoke-virtual/range {v0 .. v5}, Lrexsee/multimedia/RexseeImage;->scale(Ljava/lang/String;Ljava/lang/String;III)Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v0

    goto :goto_0

    .line 121
    .end local v3    # "width":I
    .end local v7    # "sBitmap":Landroid/graphics/Bitmap;
    .end local v8    # "sFile":Ljava/io/File;
    :catch_0
    move-exception v0

    move-object v6, v0

    .local v6, "e":Ljava/lang/Exception;
    move v0, v9

    .line 122
    goto :goto_0

    .line 113
    .end local v6    # "e":Ljava/lang/Exception;
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized scaleByTargetFileSize(Ljava/lang/String;I)Z
    .locals 1
    .param p1, "source"    # Ljava/lang/String;
    .param p2, "size"    # I

    .prologue
    .line 140
    monitor-enter p0

    :try_start_0
    invoke-virtual {p0, p1, p1, p2}, Lrexsee/multimedia/RexseeImage;->scaleByTargetFileSize(Ljava/lang/String;Ljava/lang/String;I)Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized scaleByTargetFileSize(Ljava/lang/String;Ljava/lang/String;I)Z
    .locals 7
    .param p1, "source"    # Ljava/lang/String;
    .param p2, "target"    # Ljava/lang/String;
    .param p3, "size"    # I

    .prologue
    const/4 v6, 0x0

    .line 130
    monitor-enter p0

    :try_start_0
    invoke-static {p1}, Lrexsee/multimedia/RexseeImage;->getFormat(Ljava/lang/String;)Landroid/graphics/Bitmap$CompressFormat;

    move-result-object v3

    invoke-virtual {v3}, Landroid/graphics/Bitmap$CompressFormat;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {p2}, Lrexsee/multimedia/RexseeImage;->getFormat(Ljava/lang/String;)Landroid/graphics/Bitmap$CompressFormat;

    move-result-object v4

    invoke-virtual {v4}, Landroid/graphics/Bitmap$CompressFormat;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v3

    if-nez v3, :cond_0

    move v3, v6

    .line 136
    :goto_0
    monitor-exit p0

    return v3

    .line 131
    :cond_0
    :try_start_1
    invoke-static {p1}, Lrexsee/core/utilities/Utilities;->prepareReadFile(Ljava/lang/String;)Ljava/io/File;

    move-result-object v2

    .line 132
    .local v2, "sFile":Ljava/io/File;
    if-nez v2, :cond_1

    move v3, v6

    goto :goto_0

    .line 133
    :cond_1
    mul-int/lit16 v3, p3, 0x400

    int-to-float v3, v3

    invoke-virtual {v2}, Ljava/io/File;->length()J

    move-result-wide v4

    long-to-float v4, v4

    div-float/2addr v3, v4

    float-to-double v3, v3

    invoke-static {v3, v4}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide v3

    double-to-float v1, v3

    .line 134
    .local v1, "rate":F
    invoke-virtual {p0, p1, p2, v1}, Lrexsee/multimedia/RexseeImage;->scaleByRate(Ljava/lang/String;Ljava/lang/String;F)Z
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    move-result v3

    goto :goto_0

    .line 135
    .end local v1    # "rate":F
    .end local v2    # "sFile":Ljava/io/File;
    :catch_0
    move-exception v3

    move-object v0, v3

    .local v0, "e":Ljava/lang/Exception;
    move v3, v6

    .line 136
    goto :goto_0

    .line 130
    .end local v0    # "e":Ljava/lang/Exception;
    :catchall_0
    move-exception v3

    monitor-exit p0

    throw v3
.end method

.method public setExif(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z
    .locals 7
    .param p1, "path"    # Ljava/lang/String;
    .param p2, "tag"    # Ljava/lang/String;
    .param p3, "value"    # Ljava/lang/String;

    .prologue
    const/4 v6, 0x0

    .line 175
    invoke-virtual {p1}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v2

    .line 176
    .local v2, "p":Ljava/lang/String;
    const-string v3, "file://"

    invoke-virtual {v2, v3}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v3

    if-eqz v3, :cond_0

    const-string v3, "file:///android_asset"

    invoke-virtual {v2, v3}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v3

    if-eqz v3, :cond_1

    .line 177
    :cond_0
    iget-object v3, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/multimedia/RexseeImage;->getInterfaceName()Ljava/lang/String;

    move-result-object v4

    const-string v5, "Only the images in the external storage can be set exif."

    invoke-virtual {v3, v4, v5}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    move v3, v6

    .line 187
    :goto_0
    return v3

    .line 181
    :cond_1
    :try_start_0
    new-instance v1, Landroid/media/ExifInterface;

    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v3

    invoke-virtual {v3}, Landroid/net/Uri;->getPath()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v1, v3}, Landroid/media/ExifInterface;-><init>(Ljava/lang/String;)V

    .line 182
    .local v1, "exif":Landroid/media/ExifInterface;
    invoke-virtual {v1, p2, p3}, Landroid/media/ExifInterface;->setAttribute(Ljava/lang/String;Ljava/lang/String;)V

    .line 183
    invoke-virtual {v1}, Landroid/media/ExifInterface;->saveAttributes()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 184
    const/4 v3, 0x1

    goto :goto_0

    .line 185
    .end local v1    # "exif":Landroid/media/ExifInterface;
    :catch_0
    move-exception v3

    move-object v0, v3

    .line 186
    .local v0, "e":Ljava/lang/Exception;
    iget-object v3, p0, Lrexsee/multimedia/RexseeImage;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/multimedia/RexseeImage;->getInterfaceName()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4, v0}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    move v3, v6

    .line 187
    goto :goto_0
.end method
